import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  // mode: 'history',
  scrollBehavior (to, from, savedPosition) {
    if (to.hash) {
      return {
        selector: to.hash
      }
    } else {
      return { x: 0, y: 0 }
    }
  },
  routes: [
    {
      path: '/',
      name: 'index',
      component: () => import('./views/index.vue') // 首页
    }, {
      path: '/stuEnroll',
      name: 'stuEnroll',
      component: resolve => require(['@/views/stuEnroll'], resolve)// MBA招生申请页面
    }, {
      path: '/stuEnrollInfo',
      name: 'stuEnrollInfo',
      component: resolve => require(['@/views/stuEnrollInfo'], resolve)// MBA招生申请预览
    }, {
      path: '/additional',
      name: 'additional',
      component: () => import('./views/additional.vue')// 补充材料页
    }, {
      path: '/addPreview',
      name: 'addPreview',
      component: () => import('./views/addPreview.vue')// 补充材料页预览
    }, {
      path: '/college', // 院校
      name: 'college',
      component: () => import('./views/college.vue')
    }, {
      path: '/class/:schoolId/:degreeId/:classId',
      name: 'class',
      component: () => import('./views/class.vue')
    }, {
      path: '/secience/:schoolId/:degreeId',
      name: 'secience',
      component: () => import('./views/secience.vue')
    },
    {
      path: '*',
      redirect: '/'
    }
  ]
})
